import { useState, useEffect } from 'react';
import store from '../mobx/store';
import { autorun } from 'mobx';

const useAutoHandleTabbar = () => {
  useEffect(() => {
    store.tabbarShow = false;
    return () => {
      store.tabbarShow = true;
    };
  }, []);
};

const useShowBar = () => {
  const [showBar, setShowBar] = useState(true);
  useEffect(() => {
    autorun(() => {
      setShowBar(store.tabbarShow);
    });
    return () => {};
  }, []);

  return {
    showBar,
  };
};

export { useAutoHandleTabbar, useShowBar };
